<?php

	/**
	 * ========================================================
	 * 	phpGCheckout, Open Source PHP G Checkout Library
	 * 	http://www.phpgcheckout.com
	 * ========================================================
	 * 
	 * Copyright (c) 2006 Expert Database Solutions, LLC
	 * 
	 * Permission is hereby granted, free of charge, to any person obtaining a 
	 * copy of this software and associated documentation files (the "Software"), 
	 * to deal in the Software without restriction, including without limitation the 
	 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
	 * copies of the Software, and to permit persons to whom the Software is 
	 * furnished to do so, subject to the following conditions:
	 * 
	 * The above copyright notice and this permission notice shall be included in all 
	 * copies or substantial portions of the Software.
	 * 
	 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
	 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 
	 * PARTICULAR PURPOSE AND NONINFRINGEMENT. 
	 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 
	 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT 
	 * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
	 * 
	 */

	/**
	 * Google Checkout Tax Table Primitive
	 *
	 * 
	 * This class is the abstraction of a Google Checkout Tax Table object.
	 * 
	 * @author Ron Howard
	 * @copyright Expert Database Solutions, LLC 2006
	 * 
	 */
	class gShippingPackage {
		var $_id;
		var $_zipcode;
		var $_city;
		var $_region;
		var $_country;
		var $_height;
		var $_width;
		var $_length;
		
		
		/**
		 * Default Constructor
		 *
		 * @param unknown_type $price
		 * @param unknown_type $company
		 * @param unknown_type $carrier_pickup
		 * @param unknown_type $shipping_type
		 * @return gShippingOption
		 */
		function gShippingPackage($id, $zipcode, $city = null, $region = null, $country = null, $height = 0, $width = 0, $length = 0) {
			$this->_id		= $id;
			$this->_zipcode = $zipcode;
			$this->_city  	= $city;	
			$this->_region 	= $region;
			$this->_country = $country;
			$this->_height	= $height;
			$this->_width	= $width;
			$this->_length	= $length;
		}
		
		
		
		/**
		 * Returns the XML representation of the Tax Table.
		 * 
		 * @return XML Representation of Tax Table.
		 * @access  public.
		 *
		 */
		function getXML() {
			$length_unit = $GLOBALS['length_unit'];
			$str_xml = "<shipping-packages>
							<shipping-package>
								<height unit=\"$length_unit\" value=\"$this->_height\"/>
								<length unit=\"$length_unit\" value=\"$this->_length\"/>
								<width unit=\"$length_unit\" value=\"$this->_width\"/>
								<ship-from id=\"$this->_id\">
									<city>$this->_city</city>
									<region>$this->_region</region>
									<country-code>$this->_country</country-code>
									<postal-code>$this->_zipcode</postal-code>
								</ship-from>
							</shipping-package>
						</shipping-packages>";
			
			
			return $str_xml;	
		}
	}
?>